package com.zlp.quartz.spring;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Service;

import java.util.StringJoiner;

/**
 * @Author: zhulaiping
 * @Date: 2021/10/17 14:52
 */
public class SampleJob extends QuartzJobBean {

    @Autowired
    private MyService myService;


    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        StringJoiner add = new StringJoiner("=")
                .add(Thread.currentThread().getName())
                .add(myService.hello());
        System.out.println(add);
    }
}
